<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登录</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">

<script src="login/js/cookie.js"></script>

<!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->

</head>

<body>

	<div class="row">
		<div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-4 col-md-offset-4">
			<div class="login-panel panel panel-default">
				<div class="panel-heading">Log in</div>
				<div class="panel-body">
					<!-- 如果没用<s:form>：<form  action="login.action" >  
						   如果用到<s:form >：<s:form name ="form" action ="login" namespace="/">
					 -->
					<form action="login.action" role="form" id="loginForm">
						<fieldset>
							<div class="form-group">
								<input class="form-control" placeholder="Username" id="username" name="u.username" type="text" autofocus="">
							</div>
							<div class="form-group">
								<input class="form-control" placeholder="Password" id="password" name="u.password" type="password" value="">
							</div>
							<div class="checkbox">
								<label> <input id="remember" name="remember" type="checkbox" value="Remember Me">Remember Me </label>
							</div>
							<div class="form-group">
								<label> <input name="login" class="btn btn-primary" type="button" value="Login" onclick="fSubmit()"></label>
							</div>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
		<!-- /.col-->
	</div>
	<!-- /.row -->

	<script>
		function fSubmit() {
			document.getElementById("loginForm").submit();
			//alert("提交成功~");
			
			var checkbox = document.getElementById("remember");
			if (checkbox.checked) {
				var username = document.getElementById("username").value; 
				var password = document.getElementById("password").value; 
				setCookie("username",username,7,"/");  
        		setCookie("password",password,7,"/");
				//alert("记住密码~");
			} else {
				deleteCookie("username", "/");
				deleteCookie("password", "/");
				//alert("撤销记住密码~");
			}
		}
	</script>


	<script src="js/jquery-1.11.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/chart.min.js"></script>
	<script src="js/chart-data.js"></script>
	<script src="js/easypiechart.js"></script>
	<script src="js/easypiechart-data.js"></script>
	<script src="js/bootstrap-datepicker.js"></script>
	<script>

		$(function() {
			var username = "";
			var password = "";
			username = getCookieValue("username");
			document.getElementById("username").value = username;
			password = getCookieValue("password");
			document.getElementById("password").value = password;
		})

		!function($) {
			$(document)
					.on(
							"click",
							"ul.nav li.parent > a > span.icon",
							function() {
								$(this).find('em:first').toggleClass(
										"glyphicon-minus");
							});
			$(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
		}(window.jQuery);

		$(window).on('resize', function() {
			if ($(window).width() > 768)
				$('#sidebar-collapse').collapse('show')
		})
		$(window).on('resize', function() {
			if ($(window).width() <= 767)
				$('#sidebar-collapse').collapse('hide')
		})
	</script>
</body>

</html>
